package com.zg.scf.domain.vo;

import cn.hutool.core.date.DateUnit;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil;
import com.zg.common.core.req.AddReq;
import com.zg.common.core.vo.BaseVo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.NotNull;
import java.util.Date;

/**
 * DESCRIPTION
 *
 * @author zhanfeng.liang
 * @since 2025-07-14
 */

@Data
@ApiModel(value = "企业配置")
public class ConfCompanyVo extends BaseVo {

    private Long Id;

    @ApiModelProperty(value ="企业ID")
    @NotNull(message="企业不能为空")
    private Long companyId;

    @ApiModelProperty(value ="说明")
    @NotNull(message="说明不能为空")
    private String describe;

    @ApiModelProperty(value ="开始时间")
    @NotNull(message="开始时间不能为空")
    private Date beginTime;

    @ApiModelProperty(value ="结束时间")
    @NotNull(message="结束时间不能为空")
    private Date endTime;

    @ApiModelProperty(value ="状态")
    private String  state;

    @ApiModelProperty(value ="企业名称")
    private String companyName;

    private String  finalState;


    public String getFinalState(){
        if(StrUtil.equals(this.state,"0")){
            return "0";
        }else if(!DateUtil.isIn(new Date(),this.beginTime,this.endTime)){
            return "0";
        }
        return "1";
    }
}
